<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <div th:insert="common.html"></div>
    <form id="form_id">
        汽车品牌:<input type="text" name="cname"><br>

        上市时间:<input type="date" name="cdate"><br>

        <div class="form-group">
          <label for="myFile">上传文件</label>
          <input type="file" id="myFile" name="myFile" multiple/>
          <input type="text" name="cimg" id="cimg">
        </div>

        <div class="aditor">
          汽车介绍:<textarea name="ccontent"></textarea><br>
        </div>

        汽车类型 :<select name="ctype">
        <option value="-1">请选择</option>
          <option value="1">轿车</option>
          <option value="2">客车</option>
          <option value="3">越野车</option>
          <option value="4">牵引车</option>
      </select><br>
    </form>
</body>
</html>
<script>
  $(function(){
    CKEDITOR.replace("ccontent");
    $('#myFile').fileinput({
      language: 'zh',
      uploadUrl: '/file/upLoadFile',
      maxFileCount : 5,
      enctype : "multipart/form-data",
      maxFileSize : 1024,
      allowedFileExtensions : ["jpg", "png", "gif"],
      browseClass: 'btn btn-primary'
    });


    $("#myFile").on("fileuploaded", function(event, data, previewId, index){
      var imgUrl = data.response.imgUrl;
      $("#cimg").val(imgUrl);
    })
  })
</script>